package com.orange.handler.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.orange.dbhelp.page.Page;
import com.orange.handler.AuthItemService;
import com.orange.modules.dao.AuthItemRepository;
import com.orange.modules.dao.AuthSchoolGroupMapRepository;
import com.orange.modules.entity.AuthItem;
import com.orange.modules.entity.expert.AuthExpertItemMap;

@Service
public class AuthItemServiceImpl implements AuthItemService{

	@Autowired
	private AuthItemRepository authItemRepository;
	
	@Autowired
	private AuthSchoolGroupMapRepository authSchoolGroupMapRepository;
	
	@Override
	public Page<AuthItem> queryAuthItemBuPage(Integer pageNum,
			Integer pageSize, Map<String, String> map) throws SQLException {
		Page<AuthItem> page  =authItemRepository.queryAuthItemBuPage(pageNum, pageSize, map);	
		return page;
	}

	@Override
	public void insertAuthItem(AuthItem ai) throws SQLException {
		// TODO Auto-generated method stub
		authItemRepository.insertAuthItem(ai);
	}

	@Override
	public void deleteAuthItem(String pid) throws SQLException {
		// TODO Auto-generated method stub
		authItemRepository.deleteAuthItem(pid);
	}

	@Override
	public AuthItem queryAuthItemById(String pid) throws SQLException {
		AuthItem ai = authItemRepository.queryAuthItemById(pid);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemByFidAndMajor(String fid,String major) throws SQLException {
		List<AuthItem> ai = authItemRepository.queryAuthItemByFidAndMajor(fid,major);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemTwice(String type) throws SQLException {
		List<AuthItem> ai = authItemRepository.queryAuthItemTwice(type);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemByFid(String fid, String type)
			throws SQLException {
		List<AuthItem> ai = authItemRepository.queryAuthItemByFid(fid,type);
		return ai;
	}

	@Override
	public List<AuthItem> queryTwiceItemLevelById(String itemId,String schoolId ,String subject) throws SQLException {
		List<AuthItem> list = authItemRepository.queryTwiceItemLevelById(itemId,schoolId,subject);
		return list;
	}

	@Override
	public List<AuthItem> queryAuthItemTwice(String type, String major)
			throws SQLException {
		// TODO Auto-generated method stub
		List<AuthItem> ai = authItemRepository.queryAuthItemTwice(type,major);
		return ai;
	}

	/* (non-Javadoc)
	 * @see com.orange.handler.AuthItemService#queryAuthItemsByFidAndMajor(java.lang.String, java.lang.String)
	 */
	@Override
	public List<AuthItem> queryAuthItemsByFidAndMajor(String fid, String major)
			throws SQLException {
		List<AuthItem> list=authItemRepository.queryAuthItemsByFidAndMajor(fid, major);
		return list;
	}

	@Override
	public List<AuthExpertItemMap> queryAuthItemsByExpertIdAndSchoolId(
			String expertId, String schoolId) throws SQLException {
		List<AuthExpertItemMap> list = authItemRepository.queryAuthItemsByExpertIdAndSchoolId(expertId, schoolId);
		return list;
	}

	@Override
	public AuthItem queryAuthItemByFid1(String fid, String type)
			throws SQLException {
		AuthItem ai = authItemRepository.queryAuthItemByFid1(fid, type);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemByFidAndTypeAndMajor(String fid, String type,
			String major,String schoolId) throws SQLException {
		List<AuthItem> list = authItemRepository.queryAuthItemByFidAndTypeAndMajor(fid, type, major,schoolId);
		return list;
	}

	@Override
	public AuthItem queryAuthItemByFidAndTypeAndMajor1(String fid, String type,
			String major,String schoolId) throws SQLException {
		AuthItem ai = authItemRepository.queryAuthItemByFidAndTypeAndMajor1(fid, type, major,schoolId);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemByFidAndTypeAndMajor2(String fid, String type,
			String major) throws SQLException {
		List<AuthItem> ai = authItemRepository.queryAuthItemByFidAndTypeAndMajor2(fid, type, major);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemAndExpert(String schoolId)
			throws SQLException {
		List<AuthItem> list = authItemRepository.queryAuthItemAndExpert(schoolId);
		return list;
	}

	@Override
	public List<AuthItem> queryAuthCollect(String schoolId, String itemId)
			throws SQLException {
		List<AuthItem> list = authItemRepository.queryAuthCollect(schoolId, itemId);
		return list;
	}

	@Override
	public AuthItem queryIsfollow(String schoolId, String groupId)
			throws SQLException {
		AuthItem ai = authSchoolGroupMapRepository.queryIsfollow(schoolId, groupId);
		return ai;
	}

	@Override
	public List<AuthItem> queryAuthItemIndex() throws SQLException {
		// TODO Auto-generated method stub
		return this.authItemRepository.queryAuthItemIndex();
	}
	
	

}
